const user = document.querySelector('.user');
const ul = document.querySelector('.user ul');
const li = document.querySelector('li');

let str = [
  {
    img: '../../../assets/imgs/头像.jpg',
    names: '用户名',
    bol: true,
  },
  {
    img: '../../../assets/imgs/头像.jpg',
    names: '用户名',
    bol: false,
  },
  {
    img: '../../../assets/imgs/头像.jpg',
    names: '用户名',
    bol: true,
  },
  {
    img: '../../../assets/imgs/头像.jpg',
    names: '用户名',
    bol: false,
  },
  {
    img: '../../../assets/imgs/头像.jpg',
    names: '用户名',
    bol: true,
  },
];

let userHtml = '';
str.forEach(function (v) {
  userHtml += `
  <li>
  <img src="${v.img}" alt="" />
   <span>${v.names}</span>
   <a href="#">${v.bol ? '已关注' : '互相关注'}</a>
  </li>`;
});

//渲染到页面中
ul.innerHTML = userHtml;
